/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.story.basic;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

/**
 *
 * @author Administrator
 */
public class Hello {

    public void generic() {
        List<Student> list = new ArrayList<Student>();
        Student s1 = new Student("Tom", 10);
        Student s2 = new Student("Jerry", 20);
        list.add(s1);
        list.add(s2);
        for (int i = 0; i < list.size(); i++) {
            Student student = list.get(i);
            System.out.println(student.getName() + "," + student.getAge());
        }
    }

    public void treeMap() {
    	TreeMap<String,String> map = new TreeMap<String,String>();
        map.put("1001", "Tom");
        map.put("1002", "Jerry");
        map.put("1003", "Scott");

//        Set<String> keys = map.entrySet();
//        Iterator it = keys.iterator();
//        while (it.hasNext()) {
//            Map.Entry e = (Map.Entry) it.next();
//            System.out.println("key=" + e.getKey() + " value=" + e.getValue());
//        }
    }
}
